package com.qf.smartdevice.controller;

import com.qf.smartdevice.dot.Result;
import com.qf.smartdevice.pojo.SysDevice;
import com.qf.smartdevice.service.SysDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 王博康
 * @version 1.0
 * @project devicemanagementsystem
 * @description: TODO
 * @date 2022/3/26 0:45 星期六
 */
@RestController
@RequestMapping("/device")
public class SysDeviceController {

    private SysDeviceService sysDeviceService;

    @Autowired
    public void setSysDeviceService(SysDeviceService sysDeviceService) {
        this.sysDeviceService = sysDeviceService;
    }

    @PostMapping("/device")
    public Result addDevice(@RequestBody SysDevice sysDevice){
        int count = sysDeviceService.addSysDevice(sysDevice);
        return Result.setOk(count);
    }
    @GetMapping("/device/{id}")
    public Result findById(@PathVariable String id){
        return Result.setOk(sysDeviceService.findById(id));
    }


}
